﻿using System;
using System.Collections.Generic;

using System.Text;
using OpenCvSharp;

namespace RecognitionNumbers
{
    public class Rectangle
    {
        public Rectangle(CvPoint leftTop, CvPoint rightTop,  CvPoint rightBottom, CvPoint leftBottom)
        {
            lt = leftTop;
            rt = rightTop;
            lb = leftBottom;
            rb = rightBottom;
        }
        public void reset(CvPoint leftTop, CvPoint rightTop, CvPoint rightBottom, CvPoint leftBottom)
        {
            lt = leftTop;
            rt = rightTop;
            lb = leftBottom;
            rb = rightBottom;
        }
    
        public CvPoint lt { get; set; }
        public CvPoint rt { get; set; }
        public CvPoint lb { get; set; }
        public CvPoint rb { get; set; }

        public int width 
        {
            get
            {
                if ((rt.X-lt.X)>(rb.X-lb.X))
                    return (rt.X - lt.X);
                        else
                    return (rb.X - lb.X);
            }
        }
        
        public int height 
        {
            get
            {
                if ((lb.Y - lt.Y) > (rb.Y - rt.Y))
                    return (lb.Y - lt.Y);
                        else
                    return (rb.Y - rt.Y);
            }
        }
    }
}
